﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace cscript1
{

    //class FuncCheck
    //{
    //    public Type checkType<K>(K k)
    //    {
    //        if(k.GetType() == typeof(int))
    //        {

    //        }


    //        return default(K).GetType();

    //    }

    //}
    //class Testfanxing<T>
    //{
    //    public T value { get; set; }
    //}

    //class Monster
    //{
    //    public void Act()
    //    {
    //        Console.WriteLine("Base Act");
    //    }
    //}

    //class Boss:Monster
    //{
    //    public void Act()
    //    {
    //        Console.WriteLine("Boss Act");
    //    }
    //}

    //class Gobin:Monster
    //{
    //    public void Act()
    //    {
    //        Console.WriteLine("Gobin Act");
    //    }
    //}

    //class Weapon
    //{

    //}

    //class Gun : Weapon
    //{

    //}

    //class Knife : Weapon
    //{

    //}

    //class Player
    //{
    //    // 当前持有的武器
    //    public Weapon currWeapon { get; set; }

    //    public void changeWeapon(Weapon weapon)
    //    {
    //        if(weapon.GetType() == currWeapon.GetType())
    //        {
    //            Console.WriteLine("当前已经是" + currWeapon.GetType() + "无需切换");
    //            return;
    //        }

    //        if(weapon is Gun)
    //        {
    //            Gun gun = weapon as Gun;
    //            currWeapon = gun;
    //            Console.WriteLine("切换枪");
    //        }
    //        if(weapon is Knife)
    //        {
    //            Knife knife = weapon as Knife;
    //            currWeapon = knife;
    //            Console.WriteLine("切换刀");
    //        }
    //    }
    //}


    class Program
    {
        //public static Random random = new Random();

        //public static Monster RandomFunc()
        //{

        //    if(random.Next(1, 4) % 2 != 0)
        //    {
        //        return new Boss();
        //    }else
        //    {
        //        return new Gobin();
        //    }
        //}

        class SingleClass<T>
        {
            private static SingleClass<T> single;
            private SingleClass() { }
            public static SingleClass<T> Instance
            {
                get
                {
                    if(single == null)
                    {
                        single = new SingleClass<T>();
                    }
                    return single;
                }
            }

        }




        static void Main(string[] args)
        {



            //Testfanxing<int> testfanxing = new Testfanxing<int>();

            //testfanxing.value = 10;

            //Console.WriteLine(testfanxing.value);
            //Console.ReadLine();

            //FuncCheck funcCheck = new FuncCheck();

            //int a = 10;
            //char b = '2';
            //string c = "1111";
            //bool d = true;

            //Console.WriteLine(funcCheck.checkType(a));


            //List<Monster> list = new List<Monster>();

            //for(int i = 0;i < 10;i++)
            //{

            //    list.Add(RandomFunc());
            //} 

            //for(int i = 0;i < list.Count;i++)
            //{
            //    if(list[i] is Boss)
            //    {
            //        Boss boss = list[i] as Boss;
            //        boss.Act();
            //    }else if(list[i] is Gobin) 
            //    {
            //        Gobin gobin = list[i] as Gobin;
            //        gobin.Act();
            //    }
            //}

            //Player player = new Player();

            //player.currWeapon = new Knife();

            //player.changeWeapon(new Gun());

            //player.changeWeapon(new Gun());
            Console.ReadLine();
        }
    }
}
